- Install subversion. On a Debian-family Linux box, simply type:
$ sudo apt-get install subversion - Find a place to put the repository, for example,
/usr/local/myrepo. Create your repository by typing:
$ sudo svnadmin create /usr/local/myrepo - Setup remote connection with Apache2 and WebDAV.
- Make sure you have apache2 installed and DAV module enabled (reference).
- Edit the configuration file. For example,
/etc/apache2/sites/0000_xxxxx.conf - Add the following code section somewhere before the
</VirtualHost>tag.
<Location "/myrepo_http">
DAV svn
AuthName "giftalk"
SVNPath /usr/local/myrepo
AuthType Basic
AuthUserFile /usr/local/myrepo/myrepo.pw
Order deny,allow
<Limit GET HEAD OPTIONS CONNECT POST PROPFIND PUT DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require valid-user
</Limit>
</Location> - To restart the apache2 server:
$ apachectl restart
- Add authentication mechanism with
htpasswd. In the previous step we specify an file for authentication withAuthUserFile /usr/local/myrepo/myrepo.pw. To create an user account to access this repository, do:
$ htpasswd -c /usr/local/myrepo/myrepo.pw myaccount
And then input a password twice for the usermyaccount. The option-cis used to create this file (assume it doesn't exist), and add an user namedmyaccount. To add more accounts or to change the password, just skip this-coption. - Add e-mail hook
This step requires either aperlor apythonscript, depending on your system.- Go to the
hooksfolder in the repository, say,/usr/local/myrepo/hooks. There are many scripts with affix.tmplwithin. Do:
$ cp post-commit.tmpl post-commit - Assume the system use python scripts,
mailer.py. Find the script and corresponding configuration filemailer.conffrom the apache2 installation, or from internet. Copy these two files into/usr/local/myrepo/hooks/, and make sure their are executable. - Edit the
/usr/local/myrepo/hooks/post-commit, at the end of the file, add the mailing mechanism:
/usr/local/myrepo/hooks/mailer.py commit "$REPOS" "$REVS" /usr/local/myrepo/hooks/mailer.conf - In the
mailer.conf, add the e-mail address to receive the updates at the line:
to_addr = myemail@my.email.server
- Go to the
Now, this repository should be able to work properly. More on access control, please see here.